<?php

include dirname(dirname(dirname(__FILE__))) . '/include/common.php';

class webServiceSignupFacebook extends core {

    public function process() {
         $user_id = intval($_POST['user_id']);
            $fiance_first_name = $this->db->escape(trim($_POST['fianceFirstName']));
        $fiance_last_name = $this->db->escape(trim($_POST['fianceLastName']));
        $wedding_date_string = $_POST['weddingDate'];
        $wedding_date_int = strtotime("$wedding_date_string");
        $wedding_date = date('Y-m-d', $wedding_date_int);
        $result = $this->db->query("UPDATE `users` SET 
                                            `fiance_first_name` = '{$fiance_first_name}',
                                            `fiance_last_name` = '{$fiance_last_name}',
                                            `wedding_date` = '{$wedding_date}'
                                        WHERE id = '{$user_id}'");
       
         if($result){
              $this->_JSONResponse(array('error' => 0));
         } else{
               $this->_JSONResponse(array('error' => 1, 'msg' => 'Oops, something went wrong. Please try again.'));
         }                            
       
    }

}

$processor = new webServiceSignupFacebook();
$processor->process();
?>